package com.itheima.Task;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class RedisTask {

    @Autowired
    private RedisTemplate redisTemplate;


    @Scheduled(cron = "0 0/5 * * * ? ")
    public void cleanOverTimeRedis() {
        log.info("清理redis中过期的验证码--------------------------------");
        redisTemplate.delete("验证码");
    }

}
